app.controller('yinhuanliuzhuanCtrl',['$scope','serv','$location','$http','mainService',function($scope,serv,$location,$http,mainService) {
    $scope.item = serv.getData();

    var localStorage = window.localStorage;
    var token = localStorage.getItem('token');
    console.log($scope.item)
if(mainService.getData()){
        $scope.yhcs=mainService.getData().yhcs;
        $scope.jtwz=mainService.getData().jtwz;
        $scope.yhms=mainService.getData().yhms;
        $scope.slr=mainService.getData().slr;
        $scope.lzyy=mainService.getData().lzyy;
        $scope.kzcs=mainService.getData().kzcs;
}
    $scope.changeState = function () {
        mainService.setData({
            yhcs:$scope.yhcs,
            jtwz:$scope.jtwz,
            yhms:$scope.yhms,
            slr:$scope.slr,
            lzyy:$scope.lzyy,
            kzcs:$scope.kzcs,
            slrData:mainService.getData().slrData,
            yhcsData:mainService.getData().yhcsData,
            page:'liuzhuan'
        })
    };

    $scope.submit = function () {
        if(getInputs()==false){
            return;
        }
        $http({
            method: "POST",
            url: mainUrl+'/tr/tr-chek-item!updateTrChekItem4App.action',
            params: {
                'Authorization': token,
        'qm.moveName': $scope.slr,
        'qm.moveSid':mainService.getData().slrData.sid ,
        'qm.moveOrp': mainService.getData().slrData.orpSid,
        'qm.orgSid':mainService.getData().yhcsData.sid ,
        'qm.psid':$scope.item.sid ,
        'qm.reason':$scope.lzyy ,
        'qm.riskLevel':$scope.item.riskLevel ,
        'qm.troDesc':$scope.yhms ,
        'qm.troLevel':$scope.item.troLevel ,
        'qm.troMethod':$scope.kzcs ,
        'qm.troPlace':$scope.yhcs ,
        'qm.troPosition':$scope.jtwz ,
        'qm.gpsLocation':'' ,
        'qm.troSourceUrl':'' ,
        'troSourceUrl':'' ,
                'qm.flag' : 1
            }
        }).then(
            function(data, status, headers, config){
                console.log(data)
                //$scope.data = data.data.items;

                mui.hideLoading();
                mui.toast('提交成功');
                $location.path('/renwuxiangqing');
        //         localStorage.removeItem('yhcs');
        //         localStorage.removeItem('fzr');
        //         localStorage.removeItem('jtwz');
        //         localStorage.removeItem('yjya');
        //         localStorage.removeItem('zgyq');
        //         localStorage.removeItem('dateInput');
        //         localStorage.removeItem('yhms');
        //         localStorage.removeItem('lzyy');
        //         localStorage.removeItem('kzcs');
        //         // document.getElementsByClassName('mui-switch-blue').addEventListener
        //     },function(data, status, headers, config){
        //             mui.toast(data)
           }
   );

    }



}]);

